#include "MPX_SUPT.h"

char *getProcessName(int argc, char **argv){};
void block_PCB(int argc, char **argv){};
void unblock_PCB(int argc, char **argv){};
void suspend_PCB(int argc, char **argv){};
void resume_PCB(int argc, char **argv){};
pcb *allocate_PCB(NULL);
void create_PCB(NULL);
void delete_PCB(NULL);
void free_PCB(pcb *ptr);

typedef struct
{
    unsigned char *stack_top;
    unsigned char *stack_base;
} stack_area;


char *getProcessName(){
char buf[32]
int buf_size = 32;

printf("Enter the process name to block or unblock\n");
printf("> ");
sys_req(READ, TERMINAL, buf, &buf_size);

return buf;
}

void block_PCB(int argc, char **argv ){

pcb *myPCB = find_PCB(argv[0]);

if(myPCB == null)
{
	printf("Process \"%s\" not found.", argv[0]);
}
else
{	//change state?
	remove_PCB(myPCB);
	insert_PCB(Blocked_Queue, myPCB);
	printf("Process \"%S\" was successfully blocked", processName);
}
argc = argc;
}

void unblock_PCB(int argc, char **argv){

pcb *myPCB = find_PCB(argv[0]);

if(myPCB == null)
{
	printf("Process \"%s\" not found.", argv[0]);
}
else
{
	//change state?
	remove_PCB(myPCB);
	insert_PCB(Ready_Queue, myPCB);
	printf("Process \"%S\" was successfully moved to the ready queue.", processName);
}
argc = argc;
}

void suspend_PCB(int argc, char **argv){

pcb *myPCB = find_PCB(argv[0]);

if(myPCB == null)
{
	printf("Process \"%s\" not found.", argv[0]);
}
else
{
	//change state?
	remove_PCB(myPCB);
	insert_PCB(Suspended_Queue, myPCB);
	printf("Process \"%S\" was successfully moved to the suspended queue.", processName);
}
argc = argc;
}

void resume_PCB(int argc, char **argv){

pcb *myPCB = find_PCB(argv[0]);

if(myPCB == null)
{
	printf("Process \"%s\" not found.", argv[0]);
}
else
{
	//change state?
	remove_PCB(myPCB);
	insert_PCB(ready_Queue, myPCB);
	printf("Process \"%S\" was successfully moved to the ready queue.", processName);
}
 argc = argc;
}

pcb *allocate_PCB(NULL);
{
	int size = sizeof(pcb)
	int *address;
	pcb *pcb_ptr;
	
	pcb_ptr = sys_alloc_mem(size);
	adress = sys_alloc_mem(1024);
	pcb_ptr->stack_base = address;
	pcb_ptr->stack_top = pcb_ptr->stack_base + size;
	return(&pcb_ptr);
}

void create_PCB(NULL)
{
	//requires 3 arguments: name, class, priority
	setup_PCB(arg1, arg2, arg3);
}

void delete_PCB(NULL)
{
	//requires name of PCB to be deleted
	free_PCB(arg1);
}

void free_PCB(pcb *ptr)
{
	sys_free_mem(ptr->stack_base);
	sys_free_mem(ptr);
}